/********************************************************************
	copyright (c) by tnmujoy
    @created:	9/19/2011   16:23
    @filename: 	consoleScript
    @author:	Limiko Lau (limiko.lau@gmail.com)
    @brief:	    
*********************************************************************/

#ifndef GDUT_CONSOLESCRIPT_H_
#define GDUT_CONSOLESCRIPT_H_

class TConsoleScriptInterface
{
public:
    virtual int execString(const std::string& _string) = 0;
};

class TConsoleScriptAdapter
{
public:
    TConsoleScriptAdapter()
        : scriptImpl_(NULL)
    {

    }
    ~TConsoleScriptAdapter()
    {
        if (scriptImpl_)
        {
            delete scriptImpl_;
            scriptImpl_ = NULL;
        }
    }
   void setupImpl(TConsoleInterface* _scriptImpl)
   {
       scriptImpl_ = _scriptImpl;
   }
   int execString(const std::string& _string)
   {
       if (scriptImpl_)
           return scriptImpl_->execString(_string);
       return -1;
   }
protected:
private:
    TConsoleScriptInterface* scriptImpl_;
};

#endif //GDUT_CONSOLESCRIPT_H_

//
//History:
//[9/19/2011] <limiko.lau@gmail.com> created